package cn.sirun.com.fca.account.uitl;

import android.view.View;
import android.widget.RelativeLayout;

import com.tencent.cloud.iov.util.ResourcesUtils;
import com.tencent.cloud.uikit.utils.SystemUiUtils;

/**
 * @author vinsonhuang
 * @date 2018/10/26
 */
public class AccountViewUtils {

    public static void adjustTitlePadding(View view) {
        int actionBarHeight = SystemUiUtils.getActionBarHeight(ResourcesUtils.getContext());
        int statusBarHeight = SystemUiUtils.getStatusBarHeight(ResourcesUtils.getContext());
        int currentPaddingTop = view.getPaddingTop();
        int paddingTop = actionBarHeight + statusBarHeight + currentPaddingTop;
        view.setPadding(view.getPaddingLeft(), paddingTop, view.getPaddingRight(),
                view.getPaddingBottom());
    }

    public static void adjustTitleMargin(View view) {
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)
                view.getLayoutParams();
        int actionBarHeight = SystemUiUtils.getActionBarHeight(ResourcesUtils.getContext());
        int statusBarHeight = SystemUiUtils.getStatusBarHeight(ResourcesUtils.getContext());
        int marginTop = actionBarHeight + statusBarHeight + layoutParams.topMargin;
        layoutParams.setMargins(layoutParams.leftMargin, marginTop, layoutParams.rightMargin,
                layoutParams.bottomMargin);
    }
}
